//
//  RETProductImageCell.m
//  Retail
//
//  Created by ChenJie on 4/1/20.
//  Copyright © 2020 Mist. All rights reserved.
//

#import "RETProductImageCell.h"
#import "OABase.h"
#import "ZJPPTViewDefault.h"

@interface RETProductImageCell ()
<
ZJPPTViewDelegate
>

@property (nonatomic, strong) ZJPPTViewDefault *pptView;

@end

@implementation RETProductImageCell

#pragma mark - Lifecycle methods

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.backgroundColor = [UIColor whiteColor];
        
        [self.contentView addSubview:self.pptView];
    }
    return self;
}

- (void)layoutSubviews {
    [super layoutSubviews];
    
    self.pptView.frame = self.bounds;
}

- (void)prepareForReuse {
    [super prepareForReuse];
    
    //
}

#pragma mark - Public methods

+ (CGFloat)oa_heightWithWidth:(CGFloat)cellWidth viewModel:(RETProductImageCellViewModel *)viewModel {
    return 0;
}

//+ (NSMutableDictionary *)oa_componentFramesWithCellWidth:(CGFloat)cellWidth
//                                               viewModel:(RETProductImageCellViewModel *)viewModel {
//    return nil;
//}
//
//+ (CGFloat)oa_cellHeightWithComponentFrames:(NSDictionary *)componentFrames {
//    return 0;
//}

#pragma mark - Private methods



#pragma mark - Event response methods



#pragma mark - Delegate methods

#pragma mark - <ZJPPTViewDelegate>

- (NSInteger)numberOfPagesForPPTView:(ZJPPTViewOC *)pptView {
    return 2;
}

- (void)pptView:(ZJPPTViewOC *)pptView setUpPageCell:(UICollectionViewCell *)cell withIndex:(NSInteger)index {
    NSString *bannerImageName = [NSString stringWithFormat:@"img%ld", (long)(index + 1)];
    ZJPPTViewDefaultCell *defaultCell = (ZJPPTViewDefaultCell *)cell;
    defaultCell.imageView.contentMode = UIViewContentModeScaleAspectFill;
    defaultCell.imageView.backgroundColor = OAColor(ffffff);
    defaultCell.imageView.image = [UIImage imageNamed:bannerImageName];
}

#pragma mark - Setter



#pragma mark - Getter

- (ZJPPTViewDefault *)pptView {
    if (!_pptView) {
        ZJPPTViewDefault *view = [[ZJPPTViewDefault alloc] initWithDelegate:self];
        
        _pptView = view;
    }
    return _pptView;
}

#pragma mark - Memory Management Methods

- (void)dealloc {
}

@end
